//
//  HMWaterfallFlowLayout.h
//  03_瀑布流
//
//  Created by apple on 20/6/20.
//  Copyright (c) 2020年 apple. All rights reserved.
//

#import <UIKit/UIKit.h>

@class HMWaterfallFlowLayout;

@protocol HMWaterfallFlowLayoutDelegate <NSObject>

@required
/**
 *  返回indexPath位置cell的高度
 */
- (CGFloat)waterfallFlowLayout:(HMWaterfallFlowLayout *)layout heightForItemAtIndexPath:(NSIndexPath *)indexPath withItemWidth:(CGFloat)width;

@optional
// 粗粒度设计：一个方法搞定所有数据，要求一次性返回所有数据
// 细粒度设计：一个方法对应一个数据，需要设置哪个数据就去实现哪个方法
/**
 *  返回布局的行间距
 */
- (CGFloat)rowSpacingInWaterfallFlowLayout:(HMWaterfallFlowLayout *)layout;

/**
 *  返回布局的列间距
 */
- (CGFloat)columnSpacingInWaterfallFlowLayout:(HMWaterfallFlowLayout *)layout;

/**
 *  返回布局的边距
 */
- (UIEdgeInsets)edgeInsetsInWaterfallFlowLayout:(HMWaterfallFlowLayout *)layout;

/**
 *  返回布局的列数
 */
- (NSUInteger)columnCountInWaterfallFlowLayout:(HMWaterfallFlowLayout *)layout;

@end

@interface HMWaterfallFlowLayout : UICollectionViewLayout

@property (nonatomic, weak) id<HMWaterfallFlowLayoutDelegate> delegate;

@end
